﻿using System;
using System.Collections.Generic;
using System.Globalization;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Data;
using System.Windows.Media;
using ZoneLine.Stations;

namespace ZoneLine.Views.converts
{
    internal class WorkActionConvert : IValueConverter
    {
        public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
        {
            if (value is int act)
            {
                switch (act)
                {
                    case 0: return "等待中";
                    case 1: return "允许工作";
                    case 2: return "该工件已在本工位加工完成";
                    case 3: return "该工件未在上工位加工";
                    case 4: return "该工件在上工位加工不合格";
                    case 5: return "该工件未启用";
                }
            }
            return "未知信号值" + value?.ToString();
        }


        public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
        {
            throw new NotImplementedException();
        }
    }

    internal class WorkActionColorConvert : IValueConverter
    {
        public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
        {
            if (value is int act)
            {
                switch (act)
                {
                    case 0: return new SolidColorBrush(Colors.Yellow); // return "等待中";
                    case 1: return new SolidColorBrush(Colors.Green); //return "允许工作";
                    case 2: return new SolidColorBrush(Colors.Red);// return "该工件已在本工位加工完成";
                    case 3: return new SolidColorBrush(Colors.Red);// return "该工件未在上工位加工";
                    case 4: return new SolidColorBrush(Colors.Red);// return "该工件在上工位加工不合格";
                    case 5: return new SolidColorBrush(Colors.Red);// return "该工件未启用";
                }
            }
            return new SolidColorBrush(Colors.Yellow);
        }


        public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
        {
            throw new NotImplementedException();
        }
    }
}
